package com.sudoku.command;

import com.sudoku.board.Tile;
import com.sudoku.mode.Mode;
import com.sudoku.utility.Constants;

public class EnterNumberCommand extends Command implements Constants{

    private Tile tile;
    private char prevData;
    private char data;
    private Mode mode;
    
    public EnterNumberCommand(Mode mode, Tile t, char data){
        tile=t;
        this.mode=mode;
        this.data=data;
        prevData=tile.getData();
    }
    
    @Override
    public void execute() {
    	mode.unhighlightTiles();
    	mode.highlightSimilarTiles(data);
    	
        tile.setData(data);
        tile.selected(mode.isPencilMode());
    }

    @Override
    public void undo() {
    	tile.setData(prevData);
    	mode.unhighlightTiles();
    	//mode.setSelectedTile(tile);
    }


}
